#pragma once
#include<iostream>
#include<algorithm>
#include<time.h>
#include<assert.h>
#include<vector>



//class person
//{
//	person() {}
//	
//};
//
//class student :public person
//{
//public:
//	student() {}
//};


//class func
//{
//private :
//	func() {}
//public:
//	static func GetFunc();
//	int a = 10;
//};
//
//func func::GetFunc() { return func(); }

//class func
//{
//private:
//	func() {}
//public:
//	
//	int a = 10;
//};
//class func2 :private func
//{
//public:
//	func2() {}
//	void func()
//	{
//		a = 20;
//	}
//};


void* my_memcpy(void* dst, const void* src,size_t sz)
{
	assert(dst && src);
	void* ret = dst;
	while (sz--)
	{
		*(char*)dst = *(char*)src;
		dst = (char*)dst + 1;
		src = (char*)src + 1;
	}
	return ret;
}

void* my_memmove(void*dst,const void*src,size_t sz)
{
	assert(dst && src);
	void* ret = dst;
	if(dst<src)
	{
		while (sz--)
		{
			*(char*)dst = *(char*)src;
			dst = (char*)dst + 1;
			src = (char*)src + 1;
		}
	}
	else
	{
		while (sz--)
		{
			(*((char*)dst + sz)) = (*((char*)src + sz));
		}
	}
	return ret;

}

int my_memcmp(const void* str1, const void* str2, size_t num)
{
	assert(str1 && str2);
	while (num--)
	{
		if (*(char*)str1 > *(char*)str2)
			return 1;
		else if (*(char*)str1 < *(char*)str2)
			return -1;
		else
		{
			str1 = (char*)str1 + 1;
			str2 = (char*)str2 + 1;
		}
	}
	return 0;
}

char* my_strstr(char* str1,  char* str2)
{

	while(str1)
	{
		if (*str1 == *str2)
		{
			char* cur1 = str1;
			char* cur2 = str2;
			while (cur1 && cur2 && *cur1 == *cur2)
			{
				cur1++;
				cur2++;
			}
			if (*cur2 == '\0')
				return str1;
		}
		str1++;
	}
	
}

